<template>
	<view class="content" >
		<block v-for="(item, index) in dataList" :key="index">
			<carousel  v-if="item.type == 'carousel'" :res="item.list" :listStyle="item.style"/>
			<menuSingleOne v-if="item.type == 'menuSingleOne'"  :res="item.data" :listStyle="item.style"/>
			<menuLayout v-if="item.type == 'menu'" :res="item.list" :listStyle="item.style"/>
		</block>
	</view>
</template>

<script>
	import tpl_banner from "@/pages/index/template/tpl_banner"; //轮播图模块
	import tpl_menu_single_one from "@/pages/index/template/tpl_menu_single_one.vue"; //首页视频直播
	import tpl_menu from "@/pages/index/template/tpl_menu.vue"; //菜单模块
	
	import { getIndexData } from '@/api/index'
	export default {
		components: {
			carousel: tpl_banner,
			menuSingleOne: tpl_menu_single_one,
			menuLayout:tpl_menu
		},
		data() {
			return {
				title: 'Hello',
				bannerList:[
					{img:"https://www.hzymt.zfbzhsq.com/static/applet/images/banner1.webp"},
					{img:"https://www.hzymt.zfbzhsq.com/static/applet/images/banner2.webp"}
				],
				bannerStyle:{
					
				},
				address:"",
				dataList:[],
				
			}
		},
		onLoad() {
      console.log("11");
			this.getData();
			let that=this;
			// my.getLocation({
			// 	type:2,
			// 	success: function (res) {
			// 		that.address=res.district+res.streetNumber.street
			// 		res.streetNumber.street;
			// 		console.log("res",JSON.stringify(res));
			// 		console.log('当前位置的经度：' , res.district+res.streetNumber.street);
			// 	},
			// 	fail: (err) => {
			// 		console.log("error",JSON.stringify(err));
				    
			// 	},
			// });
			
		},
		onShow(){
			
		},
		methods: {
			getData(){
				getIndexData().then((res)=>{
					if(res.data.code==0){
						this.dataList=res.data.data
					}
					console.log("getBanner",res);
				})
			}
		}
	}
</script>

<style>
	.xztv-row {
		display: flex;
		flex-direction: row;
	}
	
	.xztv-column {
		display: flex;
		flex-direction: column;
	}
	.xztv-col-center {
		align-items: center;
	}
	.xztv-row-center {
		justify-content: center;
	}
	/* 垂直居中 */
	.xztv-vertical-center {
		display: flex;
		flex-direction: column;
		align-items: center;
	}
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		width:750rpx;
		position: relative;
	}
	.address{
		position: absolute;
		height:40rpx;
		top:10rpx;
		right:40rpx;
		background-color: rgba(0, 0, 0, 0.5);
		padding-left: 10rpx;
		padding-right: 10rpx;
		border-radius: 8rpx;
	}
	

	
</style>
